<template>
  <a-modal v-model:open="visible" title="维护记录" destroyOnClose @ok="handleOk">
    <a-table :columns="columns" :data-source="tableData" rowKey="id"></a-table>
  </a-modal>
</template>
<script setup lang="ts">
  import { reactive, ref } from 'vue';
  defineExpose({
    showModal,
  });
  const emits = defineEmits(['refresh']);

  const visible = ref(false);
  function showModal(data) {
    visible.value = true;
  }
  const formRef = ref();

  const columns = [
    { title: '维护日期', dataIndex: 'date', key: 'date', width: 120, align: 'center' },
    { title: '维护人员', dataIndex: 'person', key: 'person', align: 'center' },
    { title: '维护内容', dataIndex: 'content', key: 'content', align: 'center' },
    { title: '维护结果', dataIndex: 'result', key: 'result', align: 'center' },
  ];

  const tableData = ref([
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '需要跟进',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
    {
      date: '2024-06-01',
      person: 'P00001',
      content: '',
      result: '正常',
    },
  ]);

  function handleOk() {
    visible.value = false;
  }
</script>
